package com.xydpeng.rpc.serialize;

/**
 * @author xydpeng
 * @version v1.0
 * @date: 2023/4/13
 * @description:
 */
public enum SerializationType {
    HESSIAN((byte) 1), PROTOBUF((byte) 2), PROTOSTUFF((byte) 3), Kryo((byte) 4), JSON((byte) 5);

    private byte type;

    SerializationType(byte type) {
        this.type = type;
    }

    public byte getType() {
        return type;
    }

    public static SerializationType findByType(byte type) {
        for (SerializationType e : SerializationType.values()) {
            if (e.getType() == type) {
                return e;
            }
        }
        return HESSIAN;
    }
}
